package com.pg.controller;

import io.swagger.annotations.Api;
import org.jeecg.common.aspect.annotation.AutoLog;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import com.pg.utils.Jpg2Base64Util;
import com.pg.utils.UploadFileUtils;


/**
 * <p>
 * 上传详情前端控制器
 * </p>
 *
 * @author likl
 * @since 2020-07-06
 */
@Api(tags = "上传")
@RestController
@RequestMapping(value = "/fileupload")
public class FileuploadController {

    /**
     * 用于接收前端上传文件
     *
     * @param multipartFile 图片文件
     * @return oid
     */
    @AutoLog(value = "上传图片")
    @RequestMapping(value = "/checkResultObj", method = RequestMethod.POST)
    public String upload(@RequestParam(value = "avatar") MultipartFile multipartFile) throws Exception {
        return UploadFileUtils.uploadFiles(Jpg2Base64Util.Jpg2Base64(multipartFile.getInputStream()));
    }

}
